package main

import (
	"encoding/json"
	"fmt"
	"github.com/gogf/gf/util/gconv"
	"regexp"
	"rock/customer/dto"
	"strings"
	"time"
)

var str = ""

var timeNum = 0

func aa(num int) {
	s := `{"name":"aksjdhajsdh","age":123}`
	start := time.Now().UnixNano()
	for i := 0; i < 10; i++ {
		_, err := json.Marshal(s)
		if err != nil {
			fmt.Println("err => ", err)
			return
		}
		//fmt.Println("b => ", string(b))
	}
	end := time.Now().UnixNano()
	res := end - start
	ss := fmt.Sprintf("%v - %v = %v", end, start, res)
	fmt.Println(ss)
	str = str + "+" + gconv.String(res)
	timeNum = timeNum + gconv.Int(res)
	fmt.Println("num => ", num)
}

func bb() {
	a := `ProductName                           = "创易栈"
	DealSuccessText                       = "处理成功!"
	DealErrorText                         = "处理失败!"
	WeChatErrText40029                    = "code 无效"
	WeChatErrText45011                    = "频率限制，每个用户每分钟100次"
	WeChatErrText1                        = "系统繁忙，此时请开发者稍候再试"
	Error1                                = "群成员 缓存数据 为空!"
	Error2                                = "当前技能组没有管理员!"
	Error3                                = "群 缓存数据 为空!"
	Error4                                = "私聊建群失败!"
	Remark1                               = "拉入管理员"
	Remark2                               = "群没有超级管理员"
	Remark3                               = "没有可以接入的客服"
	CustomerTarget                        = "c_"
	CustomerServiceTarget                 = "cs_"
	RobotTarget                           = "robot_"
	CustomerAvatar                        = "https://oss.emakerzone.com/admin/img/1619333657046-1618476125364-创易栈1.png"
	FAEAvatar                             = "https://oss.emakerzone.com/admin/img/1622101292602-FAE.png"
	RobotAvatar                           = "http://cloud-fae.oss-cn-shenzhen.aliyuncs.com/admin/img/1619413010273-fae.png"
	CustomerOnlineDefaultState            = 0                                             //客户默认在线状态
	OfficialAccountTemplateId             = "jKQISp2N89C0lq0pIUDCE01ELZIGd2NQUKulmQMnzfQ" //公众号推送模板 1BCqBSTTPIMEtwA3SklsSP88i433dG50CX0rLC7gTpg
	TimeBlockMsg                          = "————————— 以上为历史消息 —————————"                 //时间块
	CustomerServiceWelcomeMsg             = "亲爱的召唤师，欢迎来到新世界！！！请开始你的刷怪之旅吧"                 //客服在没有聊天的情况下，系统与客服发送的一个欢迎内容
	InvitationWaitMsg                     = "正在为您邀请专家，一对一解决问题"                            //发起邀请时提示给到客户
	TransferWaitMsg                       = "正在为您转接创易栈云FAE专家，请稍后"                         //发起转接时提示给到客户
	InvitationTimeOut                     = 5 * time.Minute                               //邀请时间间隔
	TransferTimeOut                       = 5 * time.Minute                               //
	TimeoutText                           = "超时未接"
	ServiceText                           = "为您服务"
	AddText                               = "加入会话"
	QuiteText                             = "已退出群聊"
	MergeText                             = "合并的聊天内容"
	TransIsAcceptText                     = "该转接已被接受"
	TransIsRefuseText                     = "该转接已被拒绝"
	TransIsTimeoutText                    = "该转接已超时"
	TransRefuseText                       = "拒绝了您的转接"
	InvitationRefuseText                  = "拒绝了您的邀请"
	TransMessageText                      = "向您转接了一个会话"
	InvitationMessageText                 = "邀请您参与技术解答"
	RealNamePrefix                        = "云FAE用户"
	PublicHint                            = "该用户还不是客服，但是登陆了客服端，这里给这个准客服创建一个群聊！！！"
	TimeFormatYear                        = "2006-01-02 15:04:05"
	TimeFormatYearDay                     = "2006.01.02"
	TimeFormatHourMinute                  = "15:04"
	TimeFormatHourMinuteSecond            = "15:04:05"
	UnreadMessageText                     = "创易栈客服未读消息提醒"
	UnreadCsHintText                      = "收到用户新消息，请尽快处理"
	UnreadCHintText                       = "已经有客服回复了您的问题"
	UnreadClickHintText                   = "点击本消息立即查看"
	ChatMsgTxt                            = "RC:TxtMsg"
	ChatMsgInfo                           = "RC:InfoNtf"
	ChatMsgSrs                            = "RC:SRSMsg"
	GroupMemberWithOutCustomerRobotPrefix = "GroupMemberWithOutCustomerRobot_"
	MessagesListPrefix                    = "messagesList_"
	CheckUserPrefix                       = "checkUser_"`
	c := regexp.MustCompile(`[a-zA-Z0-9]+\s\s`)
	result1 := c.FindAllStringSubmatch(a, -1)
	for _, v := range result1 {
		str = str + "|" + strings.ToLower(v[0][0:1]) + v[0][1:len(v[0])-2]
	}
	fmt.Println(str[1:])
	//rr := `productName|dealSuccessText|dealErrorText`

	//rr := `productName|dealSuccessText|dealErrorText|weChatErrText40029|weChatErrText45011|weChatErrText1|error1|error2|error3|error4|remark1|remark2|remark3|customerTarget|customerServiceTarget|robotTarget|customerAvatar|fAEAvatar|robotAvatar|customerOnlineDefaultState|officialAccountTemplateId|timeBlockMsg|customerServiceWelcomeMsg|invitationWaitMsg|transferWaitMsg|invitationTimeOut|minute|transferTimeOut|minute|timeoutText|serviceText|addText|quiteText|mergeText|transIsAcceptText|transIsRefuseText|transIsTimeoutText|transRefuseText|invitationRefuseText|transMessageText|invitationMessageText|realNamePrefix|publicHint|timeFormatYear|timeFormatYearDay|timeFormatHourMinute|timeFormatHourMinuteSecond|unreadMessageText|unreadCsHintText|unreadCHintText|unreadClickHintText|chatMsgTxt|chatMsgInfo|chatMsgSrs|messagesListPrefix|checkUserPrefix`
}

func cc() {
	v := "45_drndcvL3dPCDV4OZGai156ZHj7OftgZorYhJ6gIo7DVYjppcmmzfbEk-6t-UYFLo2g7HXDCqVNpjFsjWNWCuB1__7bvQzGDaVFMpdZiMEEsx52JxRkve52FpQvtaSIpE7u_I4CLnJnXI0G0JYZAhAIASTU"
	//originData := `{"message_uid":"ajdhajgdkjsahskdj"}`
	var m string
	err := json.Unmarshal([]byte(v), &m)
	if err != nil {
		fmt.Println("error => ", err)
		return
	}
	fmt.Println("m => ", m)
}

func dd(d int) {
	a := make([]dto.GroupRongCloudInfo, 0)
	fmt.Println(a)
	if d > 1 {
		a = append(a,dto.GroupRongCloudInfo{
		})
	}else {
		a := make([]string, 0)
		fmt.Println(a)
		return
	}
	if a == nil {
		a := make([]string, 0)
		fmt.Println(a)
		return
	}
}

func main() {
	dd(2)
}
